﻿using SHRIS.MIS.Common.Model;
using SHRIS.MIS.Common.Util.Extension;
using SHRIS.MIS.Common.Util.Model;
using SHRIS.MIS.Entity.SystemManage;
using SHRIS.MIS.IService.SystemManage;
using SHRIS.MIS.Model.Param.SystemManage;
using SHRIS.MIS.Service.SystemManage;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace SHRIS.MIS.Business.SystemManage
{
    public class LogLoginBLL
    {
        private ILogLoginService _logLoginService;

        public LogLoginBLL(ILogLoginService logLoginService)
        {
            _logLoginService = logLoginService;
        }

        #region 获取数据
        public async Task<TEntity<List<LogLoginEntity>>> GetList(LogLoginListParam param)
        {
            TEntity<List<LogLoginEntity>> obj = new TEntity<List<LogLoginEntity>>();
            obj.Data = await _logLoginService.GetList(param);
            obj.Tag = 1;
            return obj;
        }

        public async Task<TEntity<List<LogLoginEntity>>> GetPageList(LogLoginListParam param, Pagination pagination)
        {
            TEntity<List<LogLoginEntity>> obj = new TEntity<List<LogLoginEntity>>();
            obj.Data = await _logLoginService.GetPageList(param, pagination);
            obj.Total = pagination.TotalCount;
            obj.Tag = 1;
            return obj;
        }

        public async Task<TEntity<LogLoginEntity>> GetEntity(Guid id)
        {
            TEntity<LogLoginEntity> obj = new TEntity<LogLoginEntity>();
            obj.Data = await _logLoginService.GetEntity(id);
            obj.Tag = 1;
            return obj;
        }

        #endregion

        #region 提交数据
        public async Task<TEntity<string>> SaveForm(LogLoginEntity entity)
        {
            TEntity<string> obj = new TEntity<string>();
            await _logLoginService.SaveForm(entity);
            obj.Data = entity.Id.ParseToString();
            obj.Tag = 1;
            return obj;
        }

        public async Task<TEntity> DeleteForm(string ids)
        {
            TEntity obj = new TEntity();
            await _logLoginService.DeleteForm(ids);
            obj.Tag = 1;
            return obj;
        }

        public async Task<TEntity> RemoveAllForm()
        {
            TEntity obj = new TEntity();
            await _logLoginService.RemoveAllForm();
            obj.Tag = 1;
            return obj;
        }
        #endregion
    }
}
